GemaCoreLib
The GeMA Core library
Loading...
Searching...
No Matches
GmCellMesh Class Referenceabstract

Base interface class for CellMesh type plugins. More...

#include <gmCellMesh.h>

Inheritance diagram for GmCellMesh:
Collaboration diagram for GmCellMesh:

Classes

struct  GmCellBboxStatistics
 
struct  GmCellEdgeStatistics
 

Public Member Functions

 GmCellMesh (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Constructor.
 
virtual ~GmCellMesh ()
 Virtual destructor.
 
virtual int numCells () const =0
 Returns the number of cells in the mesh.
 
virtual int numActiveCells () const =0
 Returns the number of active cells in the mesh.
 
virtual int numGlobalCells () const
 When working with partitioned meshes, returns the number of cells in the global mesh, before partitioning.
 
virtual const GmCellcell (int cellIndex) const =0
 Returns a cell of the mesh.
 
virtual GmCellcell (int cellIndex)=0
 Non const version of cell() const.
 
virtual const GmCellMeshTopologytopology (bool create=true) const
 If the mesh supports the topology capability (hasCapability("topology") returns true), returns the mesh topology object that should be used for such queries. If there is no support, returns NULL.
 
virtual void clearTopology ()
 If the mesh supports the topology capability (hasCapability("topology") returns true), suggests to the mesh that the topology information will not be needed anymore and so can be discarded (if at all possible depending on the plugin implementation).
 
virtual bool hasSolidElements () const =0
 Returns true if the mesh includes solid elements. Notice that this is different from checking if node coordinates are 2D or 3D due to the possibility of a surface mesh with 3D coordinates (quad3d4 elements, for example)
 
virtual const int * numCellTypes () const =0
 Returns a const vector of size equal to GM_NUM_CELL_TYPES where each entry is the number of cells of that type present in the mesh.
 
virtual const int * numActiveCellTypes () const =0
 Returns a const vector of size equal to GM_NUM_CELL_TYPES where each entry is the number of active cells of that type present in the mesh.
 
virtual int maxNumCellNodes () const =0
 Returns the maximum number of nodes in a mesh cell (equivalent to calculating the maximum of the number of nodes of each type that has a non zero entry in the vector returned by numCellTypes())
 
virtual int maxNumCellGhostNodes () const
 Returns the maximum number of ghost nodes in a mesh cell.
 
virtual int maxTotalNumCellNodes () const
 Returns the maximum total number of nodes (normal + ghost) in a cell mesh.
 
virtual void ghostNodesUpdated (int nghost, int ntotal)
 Informs the mesh that the number of ghost nodes / total num nodes in a cell was updated to the given values, so that the mesh can update its statistics returned by maxNumCellGhostNodes() and maxTotalNumCellNodes().
 
virtual void activeCellUpdated (GmCellType type, bool active)=0
 Informs the mesh that a cell had its active state changed, being made active / inactive. Called by GmCell::setactive()
 
virtual bool isValid (QMap< int, int > &nonValidIds, bool valNonPlanar=false, bool print=true, double tol=1e-3) const
 Returns true if all the mesh cells are valid. Fill the non-valid cell ids if required.
 
virtual bool isQualityGT (double minQuality) const
 
virtual void qualityHistogram (QVector< int > &hist, int nbins=10) const
 
virtual double edgeMinLength ()
 
virtual double edgeMaxLength ()
 
virtual double cellBboxMinLength ()
 
virtual double cellBboxMaxLength ()
 
void clearCellStatistics ()
 Clears cell statistics returned by edgeMaxLength() function and friends forcing its recalculation on next usage.
 
void printQualityHistogram (bool activeOnly=true) const
 Prints cells quality histogram. If activeOnly is true, only the active cells will be scanned, all of them otherwise. Default = true.
 
virtual QStringList cellGroupIds () const
 Returns a list with the names of the available cell groups.
 
virtual int numCellsInGroup (int groupIndex) const
 Returns the number of cells present in the group referenced by groupIndex.
 
virtual const GmCellcellInGroup (int groupIndex, int cellIndex) const
 Returns a cell present in the group referenced by groupIndex.
 
virtual GmCellcellInGroup (int groupIndex, int cellIndex)
 Non const version of cellInGroup() const.
 
virtual const QMap< QString, GmCellBoundary * > & cellBoundaryGroups () const =0
 Returns a map of boundaries registered within the mesh. Each entry in the returned map contains a group of cell edges or a group of cell faces that together define a boundary, indexed by group name.
 
virtual const QList< GmPropertySet * > & propertySets () const =0
 Returns a reference to the list of property sets associated to this mesh.

 
virtual int propertySetIndex (QString id) const =0
 
virtual GmValueInfocellPropertyInfo (QString id) const
 Returns the metadata of the property named by id.
 
virtual GmCellAccessorcellPropertyAccessor (QString id, Unit desiredUnit, const GmLogCategory &logger) const
 Returns an accessor object for the property named by id.
 
virtual QStringList cellValueIds (int filter=-1) const
 Returns a list with the id names for every attribute or state var associated with mesh cell, depending on the filter parameter. No special order is enforced. If filter is -1, includes both of them, first state vars and then cell attributes since that is the order used by printing routines.
 
virtual GmValueInfocellValueInfo (QString id, int filter=-1) const
 Returns the metadata describing the cell values (attribute / state var) associated with the named id.
 
virtual GmCellAccessorcellValueAccessor (QString id, Unit desiredUnit, const GmLogCategory &logger) const
 Creates an accessor object for the cell attribute named id.
 
virtual GmCellAccessorcellValueAccessor (QString id, int snum, bool locked, Unit desiredUnit, const GmLogCategory &logger) const
 Overloads cellValueAccessor(QString, Unit, ...) to return an accessor for the requested previous state of a value.
 
virtual GmCellAccessorcellStateVarAccessorFromDof (int dof, Unit desiredUnit, GmStateVar **stateVar) const
 Creates an accessor object for the state var associated with the requested degree of freedom number. Returns NULL if the dof number is invalid or if that cell state var is not associated with this mesh.
 
virtual int addCells (int *numCellTypes)
 Adds new cells to the mesh, WHITHOUT initializing their nodes or attributes.
 
virtual QList< int > addedCells () const
 If the mesh supports mesh edition (hasCapability("addCells") returns true), this function should return a list with cell identifiers added to the mesh by calls to addCells() since the mesh creation or since the last call to clearAddedCells()
 
virtual void clearAddedCells ()
 Method called by the assembler to clear the internal list used to track added cells. See comments on addedCells().
 
virtual int addCellGroup (QString groupName)
 Adds a new (empty) cell group to the mesh.
 
virtual bool addCellsToGroup (int groupId, const QVector< int > &cellIds)
 Adds the set of cells in the given list to the cell group. Assumes that the intersection of the given list with the current group cells is empty.
 
virtual bool addCellsToGroup (int groupId, const QVector< QPair< int, int > > &cellIds)
 Adds the set of cells in the given list to the cell group.. The set of added cells is given by a vector with cell ranges. Each pair entry contains the cell index for the first and last cell in the range. Assumes that there is no intersection among the ranges and that the intersection of the given ranges with the current group cells is empty.
 
virtual bool addCellValueSet (GmValueInfo *info)
 Creates a new value set for storing data associated with the attribute whose metadata information was received as a parameter.
 
virtual void removeCellValueSet (QString id)
 Removes cell attribute set associated to the specified id. Do nothing if such cell attribute set is not stored in the mesh.
 
virtual bool initCellValueSets ()
 Initializes all the value set groups after the addition of cell attributes by calls to addCellValueSet(). MUST be called even if the mesh initially does not have any cell attribute, AFTER the number of mesh cells has been correctly initialized!
 
virtual void beginAddingCellValueSets ()
 Initializes a block where calls to addCellValueSet() will only initialize the new attribute value set at the call to endAddingCellValueSets(). See the comments at addCellValueSet(). Only makes sense after mesh initialization.
 
virtual bool endAddingCellValueSets ()
 Ends the block started by the call to beginAddingCellValueSets(), initializing all the value sets that where added in between. See the comments at addCellValueSet(). Returns false in case of errors.
 
virtual void clearCellValueSets ()
 An auxiliary function used to remove every valueSet stored in the mesh. Handy for plugins to cleanup on errors.
 
virtual void clearCellValueSetsData ()
 An auxiliary function used to remove all data from every valueSet stored in the mesh (the value sets themselves remain).
 
virtual bool saveState (GmValueSet::SaveStateMode mode, const GmLogCategory &logger)
 Simmilar to saveNodeValueState() / saveCellValueState(), saves the current state of all nodal and cell values that support state saving. See saveNodeValueState() / saveCellValueState() for more details.
 
virtual bool saveCellValueState (QString id, GmValueSet::SaveStateMode mode, const GmLogCategory &logger)
 Saves the current state for the requested id, creating a new current state.
 
virtual int numCellValueStates (QString id) const
 Returns the number of existing states for the requested id or -1 if the id doesn't exists.
 
virtual QString cellValueStateTag (QString id, int snum) const
 Returns the state tag attached to the requested state of the named value or "" if the id doesn't exists.
 
virtual double cellValueStateTime (QString id, int snum) const
 Returns the time tag attached to the requested state of the named value or -1 if the id doesn't exists.
 
virtual void setCellValueStateTag (QString id, int snum, QString tag)
 Sets a tag name for the requested state of the named value. Does nothing if the id doesn't exists.
 
virtual void setCellValueStateTime (QString id, int snum, double time)
 Sets a time tag for the requested state of the named value. Does nothing if the id doesn't exists.
 
virtual void printParameters (const GmLogCategory &logger)
 Reimplements the standard Mesh::printParameters() method to add information about cells.
 
virtual void printValues (const GmLogCategory &logger, int options=GM_PRINT_DEFAULT)
 Reimplements the standard Mesh::printValues() method to add information about cells.
 
virtual size_t cellMemory () const =0
 Returns the approximate memory used for storing mesh cells (does not include memory for attributes)
 
virtual size_t cellGroupsMemory () const =0
 Returns the approximate memory used for storing cell groups.
 
virtual size_t cellBoundariesMemory () const =0
 Returns the approximate memory used for storing cell boundaries.
 
GmValueSetGroupcellValueSetGroup () const
 Returns the ValueSetGroup object used to store the set of mesh cell value sets. This is a very specialized function. Use only if you know what you are doing...
 
GmValueSetcellValueSet (QString id) const
 Returns the value set associated with the given cell attribute.
 
const GmCellGroupSetcellGroupSet (const QList< int > &groupIdList, bool disjoint)
 Auxiliar function used to manage cell group sets attached to the mesh.
 
const QVector< GmCellGroupSet * > & cellGroupSets () const
 Returns the list of stored cell group set objects.
 
void clearCellGroupSetsData (bool keepMeshSet)
 An auxiliary function used to remove all cell groups stored in the mesh.
 
- Public Member Functions inherited from GmMesh
 GmMesh (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Constructor.
 
virtual ~GmMesh ()
 Virtual destructor.
 
virtual const char * pluginCategory () const
 Returns the plugin category.
 
virtual bool hasCapability (QString capabilityName) const =0
 This function should return true or false to indicate whether the mesh implementation supports the requested capability or not. Capabilities are refered by string names in order to enable derived interfaces to extend the available capabilities that can be queried.
 
virtual bool useDualVectors () const =0
 Returns true if the mesh data is stored in a "dual" vector, instead of a single one.
 
virtual void pushProxy (lua_State *L, const GmLogCategory &logger)=0
 Pushes a proxy object for the current mesh onto the Lua stack.

 
virtual GmValueInfonodeCoordInfo () const =0
 Returns metadata with information about node coordinates.
 
virtual GmValueAccessornodeCoordAccessor (Unit desiredUnit, const GmLogCategory &logger) const =0
 Returns an accessor object used to access node coordinates.
 
virtual int numNodes () const =0
 Returns the number of nodes in the mesh.
 
virtual int numGhostNodes () const
 Returns the number of ghost nodes in the mesh.
 
int totalNumNodes () const
 Returns the total number of nodes in the mesh, including normal nodes & ghost nodes.
 
virtual int numGlobalNodes () const
 When working with partitioned meshes, returns the number of nodes in the global mesh, before partitioning.
 
virtual int numGlobalGhostNodes () const
 When working with partitioned meshes, returns the number of ghost nodes in the global mesh, before partitioning.
 
int totalNumGlobalNodes () const
 Returns the total number of nodes in the mesh, including normal nodes & ghost nodes.
 
int toLinearGhostIndex (int nodeIndex) const
 If nodeIndex is a value with its high bit set, returns the index (high bit cleared)
 
int toLocalGhostIndex (int nodeIndex) const
 Given a global ghost index (a value >= numNodes() and < totalNumNodes()), returns a zero based version of the index. If index is a 'geometry index' (nodeIndex < numNodes()), returns a negative value.
 
virtual const QMap< QString, GmNodeSet * > & nodeSets () const =0
 Returns a map of node sets registered within the mesh. Each entry in the returned map contains a group of nodes, indexed by group name.
 
QStringList nodeValueIds (int filter=-1) const
 Returns a list with the id names for every attribute or state var associated with mesh nodes, depending on the filter parameter. No special order is enforced. If filter is -1, includes both of them, first state vars and then node attributes
since that is the order used by printing routines.
 
virtual GmValueInfonodeValueInfo (QString id, int filter=-1) const
 Returns the metadata describing the values (attribute / state var) associated with the value id.
 
virtual GmValueAccessornodeValueAccessor (QString id, Unit desiredUnit, const GmLogCategory &logger) const
 Creates an accessor object for the values (attribute / state var) associated with the value id.
 
virtual GmValueAccessornodeValueAccessor (QString id, int snum, bool locked, Unit desiredUnit, const GmLogCategory &logger) const
 Overloads nodeValueAccessor(QString, Unit, ...) to return an accessor for the requested previous state of a value.
 
virtual GmValueAccessornodeStateVarAccessorFromDof (int dof, Unit desiredUnit, GmStateVar **stateVar) const
 Creates an accessor object for the state var associated with the requested degree of freedom number. Returns NULL if the dof number is invalid or if that state var is not associated with this mesh.
 
virtual bool addNodeValueSet (GmValueInfo *info)
 Creates a new value set for storing data associated with the metadata information received as a parameter.
 
virtual void removeNodeValueSet (QString id)
 Removes node value set associated to the specified id. Do nothing if such node value set is not stored in the mesh.
 
virtual bool initNodeValueSets ()
 Initializes all the value set groups after the addition of node attributes by calls to addNodeValueSet(). MUST be called even if the mesh initially does not have any node attribute / stat var, AFTER the number of mesh nodes and ghost nodes has been correctky initialized!
 
virtual void beginAddingNodeAttributeSets ()
 Initializes a block where calls to addNodeValueSet() will only initialize the new attribute value set at the call to endAddingGaussAttributeSets(). See the comments at addNodeValueSet(). Only makes sense after mesh initialization.
 
virtual bool endAddingNodeAttributeSets ()
 Ends the block started by the call to beginAddingGaussAttributeSets(), initializing all the value sets that where added in between. See the comments at addNodeValueSet(). Returns false in case of errors.
 
virtual void clearNodeValueSets ()
 Removes every valueSet stored in the mesh (attributes and state variables). Handy for plugins to cleanup on errors.
 
virtual void clearNodeValueSetsData ()
 An auxiliary function used to remove all data from every valueSet stored in the mesh (the value sets themselves remain).
 
virtual bool saveNodeValueState (QString id, GmValueSet::SaveStateMode mode, const GmLogCategory &logger)
 Saves the current state for the requested id, creating a new current state.
 
virtual int numNodeValueStates (QString id) const
 Returns the number of existing states for the requested id or -1 if the id doesn't exists.
 
virtual QString nodeValueStateTag (QString id, int snum) const
 Returns the state tag attached to the requested state of the named value or "" if the id doesn't exists.
 
virtual double nodeValueStateTime (QString id, int snum) const
 Returns the time tag attached to the requested state of the named value or -1 if the id doesn't exists.
 
virtual void setNodeValueStateTag (QString id, int snum, QString tag)
 Sets a tag name for the requested state of the named value. Does nothing if the id doesn't exists.
 
virtual void setNodeValueStateTime (QString id, int snum, double time)
 Sets a time tag for the requested state of the named value. Does nothing if the id doesn't exists.
 
virtual int addNodes (int numNodes)
 Adds numNodes to the mesh, WHITHOUT initializing their coordinates or attributes.
 
virtual int addGhostNodes (int numNodes)
 Similar to addNodes, this function adds ghost nodes to the mesh, WHITHOUT initializing their coordinates or attributes. This function should be reimplemented by mesh implementations that support ghost nodes (hasCapability("ghostNodes") returns true).
 
virtual void clear ()
 Clears mesh nodes (and cells + other mesh related information depending on the concrete mesh type) if the mesh supports this operation (hasCapability("clear") returns true).
 
QMap< QString, GmPhysicsUserFunctions * > & userFunctionsObjMap () const
 Returns the mesh map storing physics user function objects.
 
virtual size_t nodeMemory () const =0
 Returns the approximate memory used for storing mesh nodes (does not include memory for s.v./attributes)
 
virtual size_t nodeSetsMemory () const =0
 Returns the approximate memory used for storing node sets.
 
virtual GmPCRpcrObject () const =0
 Returns the PCR(Partition - Color - Renumber) object associated with this mesh. Should NEVER return NULL. If no PCR plugin object has been explicitely associated with the mesh by the user, or implicitely associated by default configuration options, a default object with no partition, coloring or renumbering MUST be returned. This default object is useful to keep code simple, without unnecessary conditions.
 
GmValueSetGroupnodeValueSetGroup () const
 Returns the ValueSetGroup object used to store the set of mesh node value sets. This is a very specialized function. Use only if you know what you are doing...
 
GmValueSetnodeValueSet (QString id) const
 Returns the node value set associated with the given cell attribute. Might be NULL. See comments for nodeValueSetGroup()
 
GmValueSetGroupghostNodeValueSetGroup () const
 Returns the ValueSetGroup object used to store the set of mesh ghost node value sets. This is a very specialized function. Use only if you know what you are doing...
 
GmValueSetghostNodeValueSet (QString id) const
 Returns the ghost node value set associated with the given cell attribute. Might be NULL. See comments for ghostNodeValueSetGroup()
 
virtual void emitMeshChanged ()
 Emmits the signal meshChanged to signal other objects that the mesh has changed. Should be called by other processes after editions to the mesh like adding new nodes / cells or changing cell geometry.
 
- Public Member Functions inherited from QObject
virtual const QMetaObjectmetaObject () const const
 
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
QString objectName () const const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
bool signalsBlocked () const const
 
bool blockSignals (bool block)
 
QThreadthread () const const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
const QObjectListchildren () const const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
void dumpObjectTree () const const
 
void dumpObjectInfo () const const
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const const
 
QList< QByteArraydynamicPropertyNames () const const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
bool inherits (const char *className) const const
 
void deleteLater ()
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
 Q_CLASSINFO (Name, Value)
 
 Q_INTERFACES (...)
 
 Q_PROPERTY (...)
 
 Q_ENUMS (...)
 
 Q_FLAGS (...)
 
 Q_ENUM (...)
 
 Q_FLAG (...)
 
 Q_ENUM_NS (...)
 
 Q_FLAG_NS (...)
 
 Q_OBJECT Q_OBJECT
 
 Q_GADGET Q_GADGET
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SLOTS Q_SLOTS
 
 Q_SLOT Q_SLOT
 
 Q_EMIT Q_EMIT
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
- Public Member Functions inherited from GmPluginObject
 GmPluginObject (GmSimulationData *simulation, QString id, QString description, const GmLogCategory &logger)
 Constructor.
 
virtual ~GmPluginObject ()
 Destructor.
 
QString id () const
 Returns the object id.
 
QString description () const
 Returns the object description.
 
QString pluginTypeName () const
 Returns the hierarchical type name for the plugin object type. See also pluginName() and pluginType().
 
virtual const char * pluginName () const =0
 Returns a string identifying the plugin which implements this object. Should return the SAME string as the one read from the plugin information file in the pluginName field.
 
virtual const char * pluginType () const =0
 Returns the string identifying the plugin object type. Should return the SAME string as the one read from the plugin information file in the objectTypes table.
 
virtual bool loadPrivateData (LuaTable &table)=0
 Function called by the model loader to give the object acess to it's private parameters. Should return false only if the received parameter set makes the use of this object impossible.
 
- Public Member Functions inherited from GmGroupDumpItem
virtual ~GmGroupDumpItem ()
 Virtual destructor.
 
virtual bool stateAboutToBeSaved (GmStateDump *state)
 Virtual method called just before starting a save operation on the given state. Returning false aborts the operation.
 
virtual bool stateSaved (GmStateDump *state)
 Virtual method called just after succesfully completing a save operation on the given state. Returning false aborts the operation.
 
virtual bool stateAboutToBeLoaded (GmStateDump *state)
 Virtual method called just before starting a load operation on the given state. Returning false aborts the operation.
 
virtual bool stateLoaded (GmStateDump *state)
 Virtual method called just after succesfully completing a load operation on the given state. Returning false aborts the operation.
 

Protected Member Functions

virtual bool addStateAccessorData (GmStateDump *state, int groupId)
 Adds to 'state' accessors for all the cell attributes associated with this mesh. This includes all histories. (also adds node attributhe through the base class). Returns true on success or false on error.
 
virtual bool fillDumpControlMapData (QVariantMap *map, const GmLogCategory &logger)
 Fills the dump control data map with mesh data prior to a save operation On errors, should return false and report the error through the provided state dump logger.
 
virtual bool dumpControlMapDataLoaded (QVariantMap *map, const GmLogCategory &logger)
 Sanity checks + processing of the dump control data map after a load operation.
 
- Protected Member Functions inherited from GmMesh
GmValueSetanyVsFromId (QString id) const
 Helper function that, given an id, returns the node value set for that id if it exists. Otherwise returns the ghost value set for that id(which may also be NULL for an invalid id).
 
void printValueInfo (const GmLogCategory &logger, QString title, const QStringList &idList)
 Auxiliary function to print information about state variables or attributes.
 
virtual bool addStateItemsToGroup (GmStateDump *state, int groupId)
 Adds to 'state' a data item storing a control map, followed by geometry data filled by addStateGeometryData(), followed by mesh attribute data filled by addStateAccessorData(). All the items are added to the given group. Returns true on success or false on error.
 
virtual int controlMapStateItemType ()
 Virtual function that needs to be implemented by concrete implementation classes supporting the stateDump capability. It should return a dump type that identifies the mesh implementation.
 
virtual bool addStateGeometryData (GmStateDump *state, int groupId)
 Virtual function that needs to be implemented by concrete implementation classes supporting the stateDump capability. It should add the needed additional items to the state. Keep in mind that some of the needed control data can be added/loaded from the control map, already added to the state by the standard implementation of addStateItemsToGroup(), through the fillDumpControlMapData() / dumpControlMapDataLoaded() pair of functions.
 
- Protected Member Functions inherited from QObject
QObjectsender () const const
 
int senderSignalIndex () const const
 
int receivers (const char *signal) const const
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
- Protected Member Functions inherited from GmPluginObject
virtual const GmLogCategorylogger () const
 Returns the internal logger used by the plugin to emmit messages.
 
GmSimulationDatasimulationData () const
 Returns a reference to the simulation data object keeping global simulation information.
 

Private Member Functions

GmCellEdgeStatisticsedgeStatistics ()
 Returns the mesh edge statistics object, creating and initializing it if this is the first call. Thread-safe. Uses the DCLP.
 
GmCellBboxStatisticsbboxStatistics ()
 Returns the mesh bbox statistics object, creating and initializing it if this is the first call. Thread-safe. Uses the DCLP.
 
void computeEdgeLength (GmCellEdgeStatistics *stat)
 Computes the statistics for cell edge length.
 
void computeCellBboxLength (GmCellBboxStatistics *stat)
 Computes the statistics for cell bounding box length.
 

Private Attributes

GmValueSetGroup_cellValuesGroup
 Value set Group with cell attributes and state vars.
 
QVector< GmCellGroupSet * > _cellGroups
 A list with GmCellGroupSet objects used for traversing elements in a mesh group of cells.
 
QAtomicPointer< GmCellEdgeStatistics_meshEdgeStats
 Atomic pointer to the mesh edge statistics object.
 
QAtomicPointer< GmCellBboxStatistics_meshBboxStats
 Atomic pointer to the mesh bbox statistics object.
 
QMutex _meshStatsMutex
 Mutex protecting the creation of the statistics objects.
 

Additional Inherited Members

- Public Types inherited from QObject
typedef  QObjectList
 
- Signals inherited from GmMesh
void meshChanged ()
 Signal emmited by emitMeshChanged(). See comments on that function.
 
- Static Public Member Functions inherited from GmMesh
static bool isGhostNode (int nodeIndex)
 Returns true if the given index is a ghost node index, false if not.
 
static int setGhostFlag (int nodeIndex)
 Returns the given index with the ghost node bit set.
 
static int clearGhostFlag (int nodeIndex)
 Returns the given index with the ghost node bit cleared.
 
- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Protected Attributes inherited from GmMesh
int _stateDumpControlMapItem
 The dump item index for the control map. Used to make sure that there are no mesh data accessors prior to the map on the state.
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Base interface class for CellMesh type plugins.

This Cell Mesh interface builds upon the Mesh interface to add the concept of cells to the previous mesh type (which only stored nodes).

In this implementation, a cell is defined by a set of nodes defined in a particualr order known by the cell type.

Meshes can have heterogeneous cells and each cell can be bound to many property sets and to many attributes. In the same spirit as attributes are handled in GmMesh, the default GmCellMesh implementation includes a service to store and dynamically add attributes to cells. See GmMesh class comments for details.

If a mesh is bound to more than one property set, there should be no property id that belongs to both property sets (no name clashes).

The main differences between property sets and attributes are:

  • Cell attributes can be added dynamically to the mesh and can be sparse values. Property sets are fixed while creating / initializing the mesh. Every cell should be bound to a property set line.
  • Property sets store several values under one single denomination. One unique property reference bound to a cell references values for all the properties bound to a property set.

Constructor & Destructor Documentation

◆ GmCellMesh()

GmCellMesh::GmCellMesh ( GmSimulationData * simulation,
QString id,
QString description,
const GmLogCategory & logger )

Constructor.

Parameters
simulationReference to the simulation object.
idMesh id.
descriptionMesh description.
loggerPlugin logger object used to emmit messages

Member Function Documentation

◆ activeCellUpdated()

virtual void GmCellMesh::activeCellUpdated ( GmCellType type,
bool active )
pure virtual

Informs the mesh that a cell had its active state changed, being made active / inactive. Called by GmCell::setactive()

This function should be reimplemented by mesh implementations to update the number of active cells in the mesh.

◆ addCellGroup()

virtual int GmCellMesh::addCellGroup ( QString groupName)
inlinevirtual

Adds a new (empty) cell group to the mesh.

This function should be reimplemented by mesh implementations that support the mesh cell group edition capability (hasCapability("editGroups") returns true).

On success, it returns the new group index (the group index in the list returned by cellGroupIds()). On error, returns -1.

◆ addCells()

virtual int GmCellMesh::addCells ( int * numCellTypes)
inlinevirtual

Adds new cells to the mesh, WHITHOUT initializing their nodes or attributes.

The numCellTypes parameter should be a list with size equal to GM_NUM_CELL_TYPES, where each entry defines the number of elements of the respective type that will be added to the mesh.

The new cells should be created in the order defined by the GmCellType enumeration, i.e, if the numCellTypes list defines that we want 10 new QUAD4 elements and 20 new TRI3 elements, all the QUAD4 elements should be added before the TRI3 elements since QUAD4 appears before TRI3 in the enumeration. This allows for the user to know that the first 10 new elements are quads and the next 20 are triangles.

This function should be reimplemented by mesh implementations that support mesh edition (hasCapability("addCells") returns true). It should increase the internal space used for cells. Cell nodes and properties will be later filled by the USER with calls to the appropriate functions in GmCell. If the cells have attributes, this function should also make sure that those value sets are re-dimensioned and the new values initialised with value defaults. When dealing with Element meshes, that might include re-dimensioning Gauss indices.

VERY IMPORTANT: The cell might be in an unstable state before nodes and properties are properly set by calls to GmCell::setNodes() and GmCell::setProperties(), and so calling ANY other function in the cell before that can lead to unpredictable results.

On error, this function should leave the mesh unchanged and return -1. On success, it should return the index of the first new cell. If called with a total number of cells equal to 0, it should return -2.

IMPORTANT: This function might invalidate any data pointer returned by previous accessors. The accessor themselves remain valid, but any pointers returned by calls to value() / other functions might become invalid.

IMPORTANT 2: Users of this function should call emitMeshChanged() after changes to the mesh are completed. That allows for other objects that depend on mesh number of nodes and cell geometry to respond to the changes. The FEM assembler is an example of such object.

◆ addCellsToGroup() [1/2]

virtual bool GmCellMesh::addCellsToGroup ( int groupId,
const QVector< int > & cellIds )
inlinevirtual

Adds the set of cells in the given list to the cell group. Assumes that the intersection of the given list with the current group cells is empty.

This function should be reimplemented by mesh implementations that support the mesh cell group edition capability (hasCapability("editGroups") returns true).

Returns true on success. On error, this function should leave the mesh unchanged and return false.

◆ addCellsToGroup() [2/2]

virtual bool GmCellMesh::addCellsToGroup ( int groupId,
const QVector< QPair< int, int > > & cellIds )
inlinevirtual

Adds the set of cells in the given list to the cell group.. The set of added cells is given by a vector with cell ranges. Each pair entry contains the cell index for the first and last cell in the range. Assumes that there is no intersection among the ranges and that the intersection of the given ranges with the current group cells is empty.

This function should be reimplemented by mesh implementations that support the mesh cell group edition capability (hasCapability("editGroups") returns true).

Returns true on success. On error, this function should leave the mesh unchanged and return false.

◆ addCellValueSet()

bool GmCellMesh::addCellValueSet ( GmValueInfo * info)
virtual

Creates a new value set for storing data associated with the attribute whose metadata information was received as a parameter.

The new value set takes ownership of the info object. It should be noted that info MUST have kind equal to GM_CELL_ATTRIBUTE or GM_CELL_STATEVAR.

If this function is being called during mesh loading / initialization, the added attribute will only be available for value filling through an accessor after the call to initCellValueSets(), which should be made AFTER the mesh already knows its number of cells.

When called after attribute initialization, the new attribute will be imediately initialized with the correct size and will be ready for filling, unless the call is inside a beginAddingCellValueSets() / endAddingCellValueSets call block. In that later case, the new attribute size initialization is delayed untill the end call. This allows for the addition of several attributes to a new or existing "interleaved pack" in a much more efficient way.

The function returns false in case of errors (memory could not be allocated, or the mesh already has a cell attribute with the requested id, for example). In that case, info is NOT deallocated by addCellValueSet().

◆ addStateAccessorData()

bool GmCellMesh::addStateAccessorData ( GmStateDump * state,
int groupId )
protectedvirtual

Adds to 'state' accessors for all the cell attributes associated with this mesh. This includes all histories. (also adds node attributhe through the base class). Returns true on success or false on error.

Reimplemented from GmMesh.

Reimplemented in GmElementMesh.

◆ cell()

virtual const GmCell * GmCellMesh::cell ( int cellIndex) const
pure virtual

Returns a cell of the mesh.

IMPORTANT: The returned pointer can become invalid when new cells are added to the mesh. Please do NOT store cell pointers in any structure whose life span can include mesh changes.

Parameters
cellIndexCell identifier, from 0 to numCells() - 1
Returns
Returns a pointer to the requested cell

◆ cellBboxMaxLength()

virtual double GmCellMesh::cellBboxMaxLength ( )
inlinevirtual

Returns the maximum length of a cell bounding box diagonal in the mesh. The returned statistics are calculated on first usage and are not updated automatically when cell nodes change or have their coordinates updated. Use clearCellStatistics() to force an update.

◆ cellBboxMinLength()

virtual double GmCellMesh::cellBboxMinLength ( )
inlinevirtual

Returns the minimum length of a cell bounding box diagonal in the mesh. The returned statistics are calculated on first usage and are not updated automatically when cell nodes change or have their coordinates updated. Use clearCellStatistics() to force an update.

◆ cellGroupIds()

virtual QStringList GmCellMesh::cellGroupIds ( ) const
inlinevirtual

Returns a list with the names of the available cell groups.

The order of group names in this list defines the value of group indices passed to the numCellsInGroup() and cellInGroup() functions. Support for cell groups is optional.

◆ cellGroupSet()

const GmCellGroupSet * GmCellMesh::cellGroupSet ( const QList< int > & groupIdList,
bool disjoint )

Auxiliar function used to manage cell group sets attached to the mesh.

Given a cell group set definition (the indices of the cell groups belonging to the set and whether the groups are disjoint or not), returns the group set if it already exists or creates a new group set and returns the newly created group. Returns NULL if it was impossible to create the set.

If the id list is empty, a group set that represents the entire mesh will be returned.

◆ cellInGroup()

virtual const GmCell * GmCellMesh::cellInGroup ( int groupIndex,
int cellIndex ) const
inlinevirtual

Returns a cell present in the group referenced by groupIndex.

The groupIndex parameter should be the index in the list returned by cellGroupIds() of the desired group. That means that if cellGroupIds() returns an empty list, this function should not be called at all. The cellIndex is a value between 0 and numCellsInGroup() - 1 defining the cell to be returned.

◆ cellPropertyAccessor()

GmCellAccessor * GmCellMesh::cellPropertyAccessor ( QString id,
Unit desiredUnit,
const GmLogCategory & logger ) const
virtual

Returns an accessor object for the property named by id.

If id does not reference a known property, returns NULL; Remember that there should be no intersection between property names of the several sets bound to a single mesh, so id specifies a unique property among the several possible property sets.

If desiredUnit is a known unit, different from the basic property unit, the value will be automatically converted to the desired unit. If no conversion is possible, the function returns NULL. To avoid conversions, just pass Unit() as the desiredUnit.

The logger parameter exists to allow for the accessor to use a different logger than the mesh one to report errors. For example, in an analysis context it might be interesting to report errors through the physics plugin logger instead of by the mesh logger.

IMPORTANT: The returned accessor should be deallocated by the caller.

◆ cellPropertyInfo()

GmValueInfo * GmCellMesh::cellPropertyInfo ( QString id) const
virtual

Returns the metadata of the property named by id.

If id does not reference a known property, returns NULL; Rememeber that there should be no intersection between property names of the several sets bound to a single mesh, so id specifies a unique property among the several possible property sets.

◆ cellStateVarAccessorFromDof()

GmCellAccessor * GmCellMesh::cellStateVarAccessorFromDof ( int dof,
Unit desiredUnit,
GmStateVar ** stateVar ) const
virtual

Creates an accessor object for the state var associated with the requested degree of freedom number. Returns NULL if the dof number is invalid or if that cell state var is not associated with this mesh.

For state vars that store vector values, the state var can be recognized by any value in the range covered by its base dof and the next 'n-1' values where 'n' is the vector size.

If stateVar is different from NULL, returns the state var.

IMPORTANT: To recover an accessor for a state var with known id, it's much better to call cellValueAccessor(). This is not a fast function since there are no special indices to find a state var from its dof number (but that really should not be a problem unless you have hundreds of state vars or if you need to call this in a thight lopp, which you shouldn't any way).

If desiredUnit is a known unit, different from the basic cell value unit, the value will be automatically converted to the desired unit. If no conversion is possible, the function returns NULL. To avoid conversions, just pass Unit() as the desiredUnit.

IMPORTANT 2: The returned accessor should be deallocated by the caller.

◆ cellValueAccessor() [1/2]

GmCellAccessor * GmCellMesh::cellValueAccessor ( QString id,
int snum,
bool locked,
Unit desiredUnit,
const GmLogCategory & logger ) const
virtual

Overloads cellValueAccessor(QString, Unit, ...) to return an accessor for the requested previous state of a value.

The snum parameter contains the requested state. A value of zero means the current state, 1 the previous one, 2 the one before that and so on. Valid values range from zero to the oldest state for the requested variable, which can be queried with a call to numCellValueStates(). Remember that for a value accessor to support states, the history parameter must be set in its value info object.

The locked parameter controls the behaviour of the accessor once a new state is created for the value. The 'lock' refers to the state number, so if locked is false and a new state is created, the accessor doesn't change and continues to point to the same data. If locked is true, the accessor will be locked to that state number so when a new state is created, the accessor changes the data its looking upon to reflect the new satte. For example, an accessor locked on the state 0 will always point to the current state and one locked to the state 1 will always point to the previous saved value.

See the overloaded function for the remaining parameters.

◆ cellValueAccessor() [2/2]

GmCellAccessor * GmCellMesh::cellValueAccessor ( QString id,
Unit desiredUnit,
const GmLogCategory & logger ) const
virtual

Creates an accessor object for the cell attribute named id.

If the id does not refer to a known attribute, returns NULL.

If desiredUnit is a known unit, different from the basic attribute unit, the value will be automatically converted to the desired unit. If no conversion is possible, the function returns NULL. To avoid conversions, just pass Unit() as the desiredUnit.

The logger parameter exists to allow for the accessor to use a different logger than the mesh one to report errors. For example, in an analysis context it might be interesting to report errors through the physics plugin logger instead of by the mesh logger.

IMPORTANT: The returned accessor should be deallocated by the caller.

Obs: This is equivalent to calling cellValueAccessor(id, 0, true, desiredUnit, logger)

◆ cellValueInfo()

GmValueInfo * GmCellMesh::cellValueInfo ( QString id,
int filter = -1 ) const
virtual

Returns the metadata describing the cell values (attribute / state var) associated with the named id.

Remember that cell attributes and state vars should have unique ids among themselves. If the id does not refer to a known attribute / state var, returns NULL.

If filter != -1, it should be one of GM_CELL_ATTRIBUTE or GM_CELL_STATEVAR and defines that the return value should be NULL if a matching value does not have the specified type.

◆ dumpControlMapDataLoaded()

bool GmCellMesh::dumpControlMapDataLoaded ( QVariantMap * map,
const GmLogCategory & logger )
protectedvirtual

Sanity checks + processing of the dump control data map after a load operation.

Reimplemented from GmMesh.

Reimplemented in GmElementMesh.

◆ edgeMaxLength()

virtual double GmCellMesh::edgeMaxLength ( )
inlinevirtual

Returns the maximum edge length in the mesh. Only works well with linear cells. The returned statistics are calculated on first usage and are not updated automatically when cell nodes change or have their coordinates updated. Use clearCellStatistics() to force an update.

◆ edgeMinLength()

virtual double GmCellMesh::edgeMinLength ( )
inlinevirtual

Returns the minimum edge length in the mesh. Only works well with linear cells. The returned statistics are calculated on first usage and are not updated automatically when cell nodes change or have their coordinates updated. Use clearCellStatistics() to force an update.

◆ fillDumpControlMapData()

bool GmCellMesh::fillDumpControlMapData ( QVariantMap * map,
const GmLogCategory & logger )
protectedvirtual

Fills the dump control data map with mesh data prior to a save operation On errors, should return false and report the error through the provided state dump logger.

Reimplemented from GmMesh.

Reimplemented in GmElementMesh.

◆ ghostNodesUpdated()

virtual void GmCellMesh::ghostNodesUpdated ( int nghost,
int ntotal )
inlinevirtual

Informs the mesh that the number of ghost nodes / total num nodes in a cell was updated to the given values, so that the mesh can update its statistics returned by maxNumCellGhostNodes() and maxTotalNumCellNodes().

This function should be reimplemented by mesh implementations that support ghost nodes (hasCapability("ghostNodes") returns true).

◆ maxNumCellGhostNodes()

virtual int GmCellMesh::maxNumCellGhostNodes ( ) const
inlinevirtual

Returns the maximum number of ghost nodes in a mesh cell.

This function should be reimplemented by mesh implementations that support ghost nodes (hasCapability("ghostNodes") returns true).

IMPORTANT: Depending on the concrete mesh implementation, this value might be an upper bound, reflecting that no cell has more than that number of ghost nodes, but without meaning that there is a cell with that number of ghost nodes. This allows for easier implementations for GmCell::removeGhostNode() without compromising the main usage of this function for allocating space big enough for all ghost nodes in a cell.

◆ maxTotalNumCellNodes()

virtual int GmCellMesh::maxTotalNumCellNodes ( ) const
inlinevirtual

Returns the maximum total number of nodes (normal + ghost) in a cell mesh.

This function should be reimplemented by mesh implementations that support ghost nodes (hasCapability("ghostNodes") returns true). Its value can be different from maxNumCellNodes() + maxNumCellGhostNodes() since the cell that contains the maximum number of ghost nodes might not have the maximum number of 'common' nodes.

IMPORTANT: Depending on the concrete mesh implementation, this value might be an upper bound, reflecting that no cell has more than that number of nodes, but without meaning that there is a cell with that number of nodes.
This allows for easier implementations for GmCell::removeGhostNode() without compromising the main usage of this function for allocating space big enough for all nodes in a cell.

◆ numActiveCellTypes()

virtual const int * GmCellMesh::numActiveCellTypes ( ) const
pure virtual

Returns a const vector of size equal to GM_NUM_CELL_TYPES where each entry is the number of active cells of that type present in the mesh.

The first vector entry will be filled with the number of active cells present in the mesh with type equal to the first entry in the GmCellType enumeration. The second entry counts active cells of the second enumeration type and so on.

◆ numCellsInGroup()

virtual int GmCellMesh::numCellsInGroup ( int groupIndex) const
inlinevirtual

Returns the number of cells present in the group referenced by groupIndex.

The groupIndex parameter should be the index in the list returned by cellGroupIds() of the desired group. That means that if cellGroupIds() returns an empty list, this function should not be called at all.

◆ numCellTypes()

virtual const int * GmCellMesh::numCellTypes ( ) const
pure virtual

Returns a const vector of size equal to GM_NUM_CELL_TYPES where each entry is the number of cells of that type present in the mesh.

The first vector entry will be filled with the number of cells present in the mesh with type equal to the first entry in the GmCellType enumeration. The second entry counts cells of the second enumeration type and so on.

◆ printParameters()

void GmCellMesh::printParameters ( const GmLogCategory & logger)
virtual

Reimplements the standard Mesh::printParameters() method to add information about cells.

Reimplemented from GmMesh.

Reimplemented in GmElementMesh.

◆ printValues()

void GmCellMesh::printValues ( const GmLogCategory & logger,
int options = GM_PRINT_DEFAULT )
virtual

Reimplements the standard Mesh::printValues() method to add information about cells.

Reimplemented from GmMesh.

Reimplemented in GmElementMesh.

◆ propertySetIndex()

virtual int GmCellMesh::propertySetIndex ( QString id) const
pure virtual

Returns the index in the list returned by propertySets() of the set that includes the named property.

If the id does not reference a known property, returns -1; Remember that there should be no intersection between property names of the several sets bound to a single mesh, so id specifies a unique property among the several possible property sets.

◆ propertySets()

virtual const QList< GmPropertySet * > & GmCellMesh::propertySets ( ) const
pure virtual

Returns a reference to the list of property sets associated to this mesh.

The order of the property sets in the list must be consistent with results returned from propertySetIndex(), i.e, if a call to propertySetIndex("a") returns 1, the second entry of the list should be the property set that includes the "a" property.

◆ saveCellValueState()

bool GmCellMesh::saveCellValueState ( QString id,
GmValueSet::SaveStateMode mode,
const GmLogCategory & logger )
virtual

Saves the current state for the requested id, creating a new current state.

If the value does not supports history values, does nothing, returning false. The mode parameter defines how the new state will be initialized (with a copy of the old one, with the value default or uninitialized).

The time associated with the new current state is initialized to the value of the current time as seen from the simulation data object. This can later be changed by a call to setCellValueStateTime().

Returns true if the state was created successfully, false otherwise.

◆ saveState()

bool GmCellMesh::saveState ( GmValueSet::SaveStateMode mode,
const GmLogCategory & logger )
virtual

Simmilar to saveNodeValueState() / saveCellValueState(), saves the current state of all nodal and cell values that support state saving. See saveNodeValueState() / saveCellValueState() for more details.

Reimplemented from GmMesh.

Reimplemented in GmElementMesh.

◆ topology()

virtual const GmCellMeshTopology * GmCellMesh::topology ( bool create = true) const
inlinevirtual

If the mesh supports the topology capability (hasCapability("topology") returns true), returns the mesh topology object that should be used for such queries. If there is no support, returns NULL.

For the standard GeMA mesh plugin, the data structure supporting topological queries is only built on request. If the structure was not yet built, and create is false, the function will return NULL. If create is true, it will attempt to create the topological structure and return the associated object. If there was an error creating the structure, it will return NULL and log the error. The returned object should not be released by the user. Another way for creating the topological structure is by setting to true the topology flag on the mesh definition (for the GeMA mesh plugin)

THIS function should probably NOT be marked as const since it should build the topological structure if needed. Although we can interpret that as a kind of optimization and handle it
with mutable attributes, it is not pretty. We are keeping it as const since removing it causes problems with interpolator classes that would require a changes in several classes to solve.


The documentation for this class was generated from the following files: